import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Main from '../views/Main.vue'
Vue.use(VueRouter)

const routes = [{
		path: '/',
		redirect: '/login'
	},
	{
		path: '/login',
		name: 'login',
		component: Login
	},
	{
		path: '/main',
		name: 'main',
		component: Main,
		children: [{
				path: '/',
				redirect: '/home'
			},
			{
				path: '/home',
				name: 'home',
				component: () => import('../views/Home.vue')
			},
			{
				path: '/community',
				name: 'community',
				component: () => import('../views/Community.vue')
			},
			{
				path: '/store',
				name: 'store',
				component: () => import('../views/Store.vue')
			},
			{
				path: '/courierStation',
				name: 'courierStation',
				component: () => import('../views/courierStation.vue')
			},
			{
				path: '/commodity',
				name: 'commodity',
				component: () => import('../views/Commodity.vue')
			}
		]
	},
	// {
	//   path: '/',
	//   name: 'home',
	//   component: HomeView
	// },
	// {
	//   path: '/about',
	//   name: 'about',
	//   // route level code-splitting
	//   // this generates a separate chunk (about.[hash].js) for this route
	//   // which is lazy-loaded when the route is visited.
	//   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
	// }
]

const router = new VueRouter({
	routes
})

export default router